import 'package:flutter/material.dart';
import 'package:flutter/services.dart' show rootBundle;
import 'package:flutter_spinkit/flutter_spinkit.dart';
typedef VoidCallbackConfirm = void Function(bool isOk);
Future<String> loadAsset(String name) async {
  return await rootBundle.loadString('assets/$name');
}

//appbar
PreferredSize getCommonAppBar(String title,
    {color: Colors.white, fontsize: 18.0}) {
  return PreferredSize( child: AppBar(
    //brightness: Brightness.light,
    iconTheme: IconThemeData(color: color),
    centerTitle: true,
    elevation: 0,
    title: Text(
      title,
      style: TextStyle(
          color: color,
          fontSize: fontsize,
          fontWeight: FontWeight.bold),
    ),
    backgroundColor: Colors.transparent,
  ),
    preferredSize: const Size.fromHeight(50),
  );
}

//loading 弹窗
showLoading(BuildContext context){
  showDialog(context:context,
      barrierDismissible: false,
      builder: (BuildContext context){

        return const Center(
            child:SizedBox(
              width: 150,
              height: 150,
              //color: Colors.black38,
              child: SpinKitCircle(
                color: Colors.white,
                size: 50,
              ),
            )

        );
      }).then((val){
    //用户点击
  });
}